package cn.itcast.service.system.impl;

import cn.itcast.dao.system.DeptDao;
import cn.itcast.domain.system.Dept;
import cn.itcast.service.system.DeptService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    private DeptDao deptDao;
    @Override
    public PageInfo<Dept> findPages(String id,int pageNum,int pages) {
        PageHelper.startPage(pageNum,pages);
        List<Dept> list = deptDao.findAllById(id);
        return new PageInfo<>(list,5);
    }

    @Override
    public List<Dept> findAllById(String id) {
        return deptDao.findAllById(id);
    }

    @Override
    public void insert(Dept dept) {
        deptDao.insert(dept);
    }

    @Override
    public void deleteById(String id) {
        deptDao.deleteById(id);
    }

    @Override
    public Dept findById(String id) {
        Dept dept = deptDao.findById(id);
        return dept;
    }

    @Override
    public void update(Dept dept) {
        deptDao.update(dept);
    }
}
